package com.dingding.web.user.action;

import javax.annotation.Resource;

import com.dingding.facade.user.dto.feedback.ReqFeedbackDTO;
import com.dingding.facade.user.service.feedback.IFeedbackFacade;
import com.dingding.web.base.action.BaseAction;

/**
 * 
 * @ClassName: FeedbackAction 
 * @Description: 意见反馈
 * @author YHQ
 * @date 2016年11月22日 下午2:44:57
 * @since V2.5.6
 * 
 */
@SuppressWarnings("serial")
public class FeedbackAction extends BaseAction{

	private String userId;
	private String fbContent;
	private Integer fbSource;
	
	private ReqFeedbackDTO reqFeedbackDTO = new ReqFeedbackDTO();
	
	@Resource(name = "feedbackFacade")
	private IFeedbackFacade feedbackFacade;
	
	/**
	 * 
	 * @Title: userFeedback 
	 * @Description: 用户意见反馈
	 * @author YHQ 
	 * @since V2.5.6
	 * @return String    返回类型
	 * 
	 */
	public String userFeedback(){
		
		// 保存用户意见反馈
		boolean flag = feedbackFacade.userFeedback(getReqFeedbackDTO());
		
		if(flag){
			super.write(super.getResJsonp("success"));	// 保存成功
		}else{
			super.write(super.getResJsonp("error"));	// 保存失败
		}
		
		return null;
	}

	/**
	 * 
	 * @Title: getReqFeedbackDTO 
	 * @Description: 将客户端请求参数封装到请求Bean
	 * @author YHQ 
	 * @since V2.5.6
	 * @return ReqFeedbackDTO    返回类型
	 * 
	 */
	public ReqFeedbackDTO getReqFeedbackDTO(){
		
		reqFeedbackDTO.setFbContent(fbContent);
		reqFeedbackDTO.setFbSource(fbSource);
		reqFeedbackDTO.setUserId(userId);
		
		return reqFeedbackDTO;
	}
	
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getFbContent() {
		return fbContent;
	}

	public void setFbContent(String fbContent) {
		this.fbContent = fbContent;
	}

	public Integer getFbSource() {
		return fbSource;
	}

	public void setFbSource(Integer fbSource) {
		this.fbSource = fbSource;
	}
	
}
